Socket
Book a DemoInstallSign in
Socket

execa

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

execa

A better child_process.{execFile,exec}

Source
npmnpm
Version
0.1.1
Version published
Weekly downloads
93M
-14.02%
Maintainers
1
Weekly downloads
 
Created
Source

execa Build Status

A better child_process.{execFile,exec}

Why

  • Promise interface.
  • Strips EOF from the output so you don't have to stdout.trim().
  • Supports shebang binaries cross-platform.
  • Improved Windows support.
  • Higher max buffer. 10 MB instead of 200 KB.

Install

$ npm install --save execa

Usage

const execa = require('execa');

execa('echo', ['unicorns']).then(result => {
	console.log(result.stdout);
	//=> 'unicorns'
});

execa.shell('echo unicorns').then(result => {
	console.log(result.stdout);
	//=> 'unicorns'
});

API

execa(file, [arguments], [options])

Execute a file directly.

Same options as child_process.execFile.

Returns a promise for a result object with stdout and stderr properties.

execa.shell(command, [options])

Execute a command through the system shell. Prefer execa() whenever possible, as it's both faster and safer.

Same options as child_process.exec.

Returns a promise for a result object with stdout and stderr properties.

options

Additional exposed options:

stripEof

Type: boolean
Default: true

Strip EOF (last newline) from the output.

License

MIT © Sindre Sorhus

Keywords

exec

FAQs

Package last updated on 07 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts